package com.atguigu.cf.test;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;

/**
 * author: 封捷
 * date: 2023/1/29 16:43
 * version: 1.0
 */
public class Demo03TaskThenRun {

    public static void main(String[] args) {
        ExecutorService threadPool = ThreadPoolProvider.getThreadPool();

        // 任务依赖关系：第一个执行完再执行第二个
        CompletableFuture.runAsync(()->{
            System.out.println("第一个任务。");
        }, threadPool).thenRun(()->{
            System.out.println("第二个任务。");
        });
    }

}
